import OSS from 'ali-oss'
let stsInfo = {
    accessKeyId: null,
    accessKeySecret: null,
    securityToken: null,
    bucketName: null,
    dir: null,
    requestId: null,
    host: null
}
export function put (name, File) {
    try {
    //     return new Promise((resolve, reject) => {
    //         if (!stsInfo.stsToken) {
    //             return csyApi.stsToken().then(result => {
    //                 stsInfo = result.result
    //                 resolve(stsInfo)
    //             })
    //         } else {
    //             resolve(stsInfo)
    //         }
    //     }).then(stsInfo => {
            const client = new OSS({
                region: 'oss-cn-shenzhen',
                // endpoint: "",
                accessKeyId: 'LTAI5tGKyPEzHa1utAWtMeBK',
                accessKeySecret: 'lixg2jpJtGgzdZWzbYLdsrOxnROk3o',
                bucket: 'avatar-blog-golxen'
                // stsToken: stsInfo.securityToken
            })
            // return client.put(stsInfo.dir + name, File)
            return client.put(name, File)
        // })
    } catch (e) {
        console.log(e)
    }
}

